﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DOTNETGROUP.Data;
using DOTNETGROUP.Entities;


public partial class Chi_Tiet_Dich_Vu : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string idDichVu = Request.Params["Id"];
            HienThi_ChitietDichVu(Convert.ToInt32(idDichVu));
            //HienThi_ChitietDichVu(1);
        }
    }

    protected void HienThi_ChitietDichVu(int idDichVu)
    {
        using (DichVu entDichVu = DataRepository.DichVuProvider.GetById(idDichVu))
        {
            if (entDichVu != null)
            {
                lblTieuDe.Text = entDichVu.TenDichVu;

                lblNoiDung.Text = Server.HtmlDecode(entDichVu.NoiDung);
                litTieuDe.Text = entDichVu.TenDichVu;
                litDienGiai.Text = String.Format("<meta content='{0}' name='description' />", entDichVu.TomTat);
                lblLoaiDichVu.Text = GetLoaiDichVu(entDichVu.IdLoaiDichVu);
                linkLoaiDichVu.NavigateUrl = "~/DichVuCatalog/" + GetTieuDe(GetLoaiDichVu(entDichVu.IdLoaiDichVu)) + "_" +
                                             entDichVu.IdLoaiDichVu + ".aspx";
            }
        }
    }

    /// <summary>
    /// Phuong thuc chuyen tieu de co dau thanh khong dau de dua vao link
    /// </summary>
    /// <param name="Char"></param>
    /// <returns></returns>
    public string GetTieuDe(object Char)
    {
        string s = Char.ToString();
        return Common.ConvertToUnSign(s);
    }

    public string GetLoaiDichVu(object idloaiDichVu)
    {
        int id = Convert.ToInt32(idloaiDichVu.ToString());
        LoaiDichVu ent_DichVu = DataRepository.LoaiDichVuProvider.GetById(id);
        return ent_DichVu.TenLoaiDichVu;
    }
}